package pe.com.pgn.consolidadorventas.servidorcentral.ws.domain.factory;

import org.apache.log4j.Logger;

import pe.com.pgn.consolidadorventas.servidorcentral.ws.domain.gnv.GnvRegistroVenta;

public class GnvParserLinea {

	static Logger logger = Logger.getLogger(GnvParserLinea.class);

	public static GnvRegistroVenta parsearLineaPrincipal(String valores[]){
		GnvRegistroVenta g = null;
		int i = 0;
		if(valores.length>0){
			g = new GnvRegistroVenta();
			try{
				g.setSerie(valores[i]);i=i+1;
				g.setNumero(valores[i]);i=i+1;
				g.setSerieMaq(valores[i]);i=i+1;
				g.setFechaVenta(valores[i]);i=i+1;
				g.setFechaProceso(valores[i]);i=i+1;
				g.setFecTurnoApertura(valores[i]);i=i+1;
				g.setFecTurnoCierre(valores[i]);i=i+1;
				g.setFecInicioLectura(valores[i]);i=i+1;
				g.setFecFinLectura(valores[i]);i=i+1;
				g.setLecturaInicial(valores[i]);i=i+1;
				g.setLecturaFinal(valores[i]);i=i+1;
				g.setRuc(valores[i]);i=i+1;
				g.setCantidad(valores[i]);i=i+1;
				g.setPrecioUnitario(valores[i]);i=i+1;
				g.setRecaudo(valores[i]);i=i+1;
				g.setValorVenta(valores[i]);i=i+1;
				g.setIgv(valores[i]);i=i+1;
				g.setPrecioVenta(valores[i]);i=i+1;
				g.setManguera(valores[i]);i=i+1;
				g.setPlaca(valores[i]);i=i+1;
				g.setCara(valores[i]);i=i+1;
				g.setRecibo(valores[i]);i=i+1;
				g.setCodIsla(valores[i]);i=i+1;
				g.setCodTurno(valores[i]);i=i+1;
				g.setEstado(valores[i]);
				
			}catch(ArrayIndexOutOfBoundsException e){
				logger.error(e.getMessage());
				g = null;
			}
		}
		return g;
	}
}
